package com.example.myspringboot.design.many;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

/**
 * @Author ZhengShan
 * @Date 2024 06 24 15 54
 **/
public class ManyDemo {

    private static final int MAX_COUNT = 3;

    private ManyDemo(){

    }

    private static final List<ManyDemo> manyList = new ArrayList<>();

    static {
        for(int i=0; i<MAX_COUNT; i++){
            manyList.add(new ManyDemo());
        }
    }

    public static ManyDemo getInstance(){
        return manyList.get(new Random().nextInt(MAX_COUNT));
    }

}
